package com.iyjhsoc.game.controller;

import com.iyjhsoc.game.domain.dto.FirstPlayerDTO;
import com.iyjhsoc.game.domain.dto.PlayerDTO;
import com.iyjhsoc.game.domain.dto.PlayerTeamDTO;
import com.iyjhsoc.game.domain.entity.PlayerTeamDO;
import com.iyjhsoc.game.domain.response.Response;
import com.iyjhsoc.game.service.PlayerTeamService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("iyj/player/tem")
@RestController
public class PlayerTeamController {

    @Autowired
    PlayerTeamService playerTeamService;

    @GetMapping("queryFirstPlayer")
    @ApiOperation(("获取首发"))
    public Response queryFirstPlayer(FirstPlayerDTO playerDTO){
        Response response = playerTeamService.queryFirstPlayer(playerDTO);
        return response;
    }

    @GetMapping("getSubstitute")
    @ApiOperation("获取替补信息")
    public Response getSubstitute(PlayerDTO playerDTO){
        Response substitute = playerTeamService.getSubstitute(playerDTO);
        return substitute;
    }

    @GetMapping("insertFirstPlayer")
    @ApiModelProperty("新增首发名单")
    public Response insertFirstPlayer(FirstPlayerDTO dto){
        Response response = playerTeamService.insertFirstPlayer(dto);
        return response;
    }
    @PostMapping("insertSubstitute")
    @ApiModelProperty("新增替补")
    public Response insertSubstitute(@RequestBody List<PlayerTeamDTO> playerTeamDTOS){
        Response response = playerTeamService.insertSubstitute(playerTeamDTOS);
        return response;
    }

    @GetMapping("updateFirstPlayer")
    public Response updateFirstPlayer(FirstPlayerDTO dto){
        Response response = playerTeamService.updateFirstPlayer(dto);
        return response;
    }

    @GetMapping("getPlayerList")
    public Response getPlayerList(FirstPlayerDTO dto){
        Response playerList = playerTeamService.getPlayerList(dto);
        return playerList;
    }

    @PostMapping("delSubstitute")
    @ApiModelProperty("删除替补")
    public Response delSubstitute(@RequestBody PlayerTeamDO playerTeamDO){
        Response response = playerTeamService.delSubstitute(playerTeamDO);
        return response;
    }
}
